$(function () {
    selectOrder();
});


/*提交---立即支付---信用卡支付消费验证接口：Secoo@consumerTransactionVerification*/
function selectOrder() {

    var b_id = localStorage.getItem("b_id");
    var datas = {
        interface:'Secoo@getApplyPayInfo', 
        b_id: b_id,/*订单id*/
    };
    common.ajax({
        data: datas,
        success: function (data) {
            if (data.status == '2000') {
                console.log(data.result);
                var list = data.result;
                for(var i = 0;i<list.length;i++){
                    var item = list[i];
                    var bill_num = decimal(item.b_borrow_amount/item.b_period,2);
                    var card_num = item.t_bank_card_code.substr(item.t_bank_card_code.length-4);
                    var html = '<dl>'
                        html += '<dt class="mg0 bd0 pb0">'+item.partner_name+'</dt>'
                        html += '<dd>订&ensp;单&ensp;号：'+item.t_pay_no+'</dd>'
                        html += '<dd>课程名称：'+item.p_name+'</dd>'
                        html += '<dd>课程金额：¥'+item.b_borrow_amount+'</dd>'
                        // html += '<dd>月交本金：¥'+bill_num+'</dd>'
                        // html += '<dd>账单期数：'+item.b_period+'期</dd>'
                        html += '<dd class="clearfix">'
                            html += '<span class="fl">信用卡账单：</span>'
                            html += '<p class="fl orange-color">¥'+bill_num+'*'+item.b_period+'期</p>'
                        html += '</dd>'
                        html += '<dd>下单时间：'+item.b_apply_time+'</dd>'
                        html += '<dd>支付时间：'+item.t_pay_time+'</dd>'
                        html += '<dd>付款方式：'+item.t_bank_name+'('+card_num+')</dd>'
                        // html += '<dd class="clearfix">'
                        //     html += '<span class="fl">信用卡账单：</span>'
                        //     html += '<p class="fl orange-color">¥'+bill_num+'*'+item.b_period+'期</p>'
                        // html += '</dd>'
                        
                    html += '</dl>'
                    $(".pay-list").append(html);
                }
            } else if (data.status == '5000') {
                falert(data.msg);
            }
        }
    });
}
/*四舍五入保留两位小数*/
function decimal(num,v){
    var vv = Math.pow(10,v);
    return Math.round(num*vv)/vv;
}